home *** CD-ROM | disk | FTP | other *** search
/ InterCD 2001 December / december_2001.iso / Audio Programs / Winamp 3.0 Beta / wa3install_beta1.exe / Lib / rotationlayer.m < prev    next >
Encoding:
Text File  |  2001-07-06  |  2.3 KB  |  62 lines

  1. //----------------------------------------------------------------------------------------
  2. //
  3. // rotationlayer.m
  4. //
  5. //----------------------------------------------------------------------------------------
  6. // Use like this :
  7. // #define ROTATION_LAYER_VAR MyVar
  8. // #include "rotationlayer.m"
  9. //
  10. //                       _MyVarInit(String containername, String layoutname, String layername); // init rotationlayer
  11. //                       _MyVarRotateDegree(double r);     // in degrees
  12. //                       _MyVarRotate(double r);           // in radians
  13. //                       double _MyVarGetRotationDegree(); // in degrees
  14. //                       double _MyVarGetRotation();       // in radians
  15. //
  16.  
  17. #define PI 3.1415926536
  18.  
  19. Global Double _##ROTATION_LAYER_VAR##R;
  20. Global Layer _##ROTATION_LAYER_VAR##Layer;
  21.  
  22. Function _##ROTATION_LAYER_VAR##Init(String containername, String layoutname, String layername);
  23. Function _##ROTATION_LAYER_VAR##RotateDegree(double r);
  24. Function _##ROTATION_LAYER_VAR##Rotate(double r);
  25. Function double _##ROTATION_LAYER_VAR##GetRotationDegree();
  26. Function double _##ROTATION_LAYER_VAR##GetRotation();
  27.  
  28. _##ROTATION_LAYER_VAR##RotateDegree(double r) {
  29.   _##ROTATION_LAYER_VAR##Rotate(r * PI / 180.0);
  30. }
  31.  
  32. _##ROTATION_LAYER_VAR##Rotate(double r) {
  33.   _##ROTATION_LAYER_VAR##R = r;
  34.   _##ROTATION_LAYER_VAR##Layer.fx_update();
  35. }
  36.  
  37. double _##ROTATION_LAYER_VAR##GetRotationDegree() {
  38.   return _##ROTATION_LAYER_VAR##R * 180 / PI;
  39. }
  40.  
  41. double _##ROTATION_LAYER_VAR##GetRotation() {
  42.   return _##ROTATION_LAYER_VAR##R;
  43. }
  44.  
  45. _##ROTATION_LAYER_VAR##Init(String containername, String layoutname, String layername) {
  46.   _##ROTATION_LAYER_VAR##Layer = getContainer(containername).getLayout(layoutname).getObject(layername);
  47.   _##ROTATION_LAYER_VAR##Layer.fx_setGridSize(1,1);
  48.   _##ROTATION_LAYER_VAR##Layer.fx_setBgFx(0);
  49.   _##ROTATION_LAYER_VAR##Layer.fx_setWrap(1);
  50.   _##ROTATION_LAYER_VAR##Layer.fx_setBilinear(1);
  51.   _##ROTATION_LAYER_VAR##Layer.fx_setRect(0);
  52.   _##ROTATION_LAYER_VAR##Layer.fx_setClear(0);
  53.   _##ROTATION_LAYER_VAR##Layer.fx_setLocalized(1);
  54.   _##ROTATION_LAYER_VAR##Layer.fx_setRealtime(0);
  55.   _##ROTATION_LAYER_VAR##Layer.fx_setEnabled(1);
  56. }
  57.  
  58. _##ROTATION_LAYER_VAR##Layer.fx_onGetPixelR(double r, double d, double x, double y) {
  59.   return r + _##ROTATION_LAYER_VAR##R;
  60. }
  61.  
  62.